package org.setaria.control.dataGrid
{
	import flash.events.Event;
	
	import mx.controls.CheckBox;
	
	public class CheckBoxItemRenderer extends CheckBox
	{
		public function CheckBoxItemRenderer()
		{
			super();
			this.addEventListener(Event.CHANGE, onChangehandler);
		}
		
		private var _column:Object;
		
		override public function set data(value:Object):void
		{
			if(value)
			{
				super.data = value;
				_column = Object(this.listData.owner).columns[this.listData.columnIndex];
//				this.selected = value.selected;
				this.selected = value[_column.dataField];
			}
		}
		private function onChangehandler(event:Event):void
		{
			data[_column.dataField] = this.selected;
		}
	}
}